#!/bin/bash
set -e

psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
    CREATE USER $SUPERSET_POSTGRES_USER WITH PASSWORD '$SUPERSET_POSTGRES_PASSWORD';
    CREATE DATABASE $SUPERSET_POSTGRES_USER;
    GRANT ALL PRIVILEGES ON DATABASE $SUPERSET_POSTGRES_USER TO $SUPERSET_POSTGRES_USER;
EOSQL
